
function loadStudents() {
	const xhttp = new XMLHttpRequest();
	xhttp.onload = function() {
		let students = JSON.parse(this.responseText)['students'];
		showTable(students)
	}
	xhttp.open("GET", "http://217.71.129.139:4036/api/students.php", true);
	xhttp.send();
}

function showTable(students) {
	let table = document.getElementById('tbl_all')

	for (let i = 0; i < students.length; i++) {
		let tr = document.createElement('tr')
		let td1 = document.createElement('td')
		let td2 = document.createElement('td')
		let td3 = document.createElement('td')
		let td4 = document.createElement('td')

		td1.textContent = students[i].id
		td2.textContent = students[i].name
		td3.textContent = students[i].surname
		td4.textContent = students[i].group

		tr.appendChild(td1)
		tr.appendChild(td2)
		tr.appendChild(td3)
		tr.appendChild(td4)

		table.appendChild(tr)
	}
}